package cn.iocoder.yudao.module.pypm.dal.mysql.productinfo;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pypm.dal.dataobject.productinfo.ProductInfoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.pypm.controller.admin.productinfo.vo.*;

/**
 * 产品信息 Mapper
 *
 * @author 钦州码头
 */
@Mapper
public interface ProductInfoMapper extends BaseMapperX<ProductInfoDO> {

    default PageResult<ProductInfoDO> selectPage(ProductInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductInfoDO>()
                .likeIfPresent(ProductInfoDO::getName, reqVO.getName())
                .betweenIfPresent(ProductInfoDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ProductInfoDO::getDescription, reqVO.getDescription())
                .eqIfPresent(ProductInfoDO::getProjectId, reqVO.getProjectId())
                .orderByDesc(ProductInfoDO::getId));
    }

}